﻿Imports System.Xml

Public Class insertRackinfo
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then Exit Sub
        insert(1)
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If TextBox1.Text = "" Then Exit Sub

        insert(0)
    End Sub

    Private Sub insert(dbflg As Integer)
        Dim lotdata As New clsDbCondData
        Dim lot As String()
        Dim objlotDefect As New clsDbLotDefect
        Dim dt As DataTable
        lot = TextBox1.Text.Split(vbCrLf)
        Dim t As Integer = 0
        For i As Integer = 0 To lot.Length - 1
            dt = lotdata.GetWbLotData(lot(i).Trim)
            If dt.Rows.Count > 0 Then
                With dt
                    If dbflg = 1 Then
                        t = t + 1
                        objlotDefect.insertRackInfo(.Rows(0)("WAFER_LOTNO"), .Rows(0)("KOUTEI_CODE").ToString, .Rows(0)("CONTAINER1").ToString, .Rows(0)("CONTAINER2").ToString, .Rows(0)("CONTAINER3").ToString, .Rows(0)("CONTAINER4").ToString, .Rows(0)("CONTAINER5").ToString)
                    Else
                        t = t + 1
                        objlotDefect.insertRackInfo(.Rows(0)("LOT_NO"), .Rows(0)("KOUTEI_CODE"), .Rows(0)("CONTAINER1").ToString, .Rows(0)("CONTAINER2").ToString, .Rows(0)("CONTAINER3").ToString, .Rows(0)("CONTAINER4").ToString, .Rows(0)("CONTAINER5").ToString)
                    End If

                End With
            Else
                MsgBox(lot(i).Trim)
            End If
        Next
        MsgBox("ok " & t)
    End Sub
End Class